DROP TABLE S004.S004_T08401 CASCADE CONSTRAINTS;

CREATE TABLE S004.S004_T08401
(
  SEQ_NO           NUMBER,
  MANUAL_CODE      NUMBER,
  CHAPTER_CODE     NUMBER,
  CHAPTER_TITLE    VARCHAR2(1000 BYTE),
  CHAPTER_SUMMARY  VARCHAR2(4000 BYTE),
  REMARKS          VARCHAR2(4000 BYTE),
  CREATED_BY       VARCHAR2(100 BYTE),
  DATE_CREATED     DATE,
  MODIFIED_BY      VARCHAR2(100 BYTE),
  DATE_MODIFIED    DATE
)
TABLESPACE HRIS
PCTUSED    0
PCTFREE    10
INITRANS   1
MAXTRANS   255
STORAGE    (
            INITIAL          64K
            NEXT             1M
            MINEXTENTS       1
            MAXEXTENTS       UNLIMITED
            PCTINCREASE      0
            BUFFER_POOL      DEFAULT
           )
LOGGING 
NOCOMPRESS 
NOCACHE
NOPARALLEL
MONITORING;

COMMENT ON TABLE S004.S004_T08401 IS 'Maintenance Table for Table of Contents';


CREATE OR REPLACE TRIGGER S004."S004_T08401_BI001" 
before insert or update or delete
 ON S004.S004_T08401 for each row
begin
   if inserting then
      if :new.seq_no is null then
         select s004_t08401_sq001.nextval
         into :new.seq_no 
         from dual;
      end if; 
     :new.created_by    := user;
     :new.date_created  := sysdate;
   elsif updating then
     :new.modified_by   := user;
     :new.date_modified := sysdate;
   end if;
end;
/


